home *** CD-ROM | disk | FTP | other *** search
/ Megaware 1 / Megaware Volume 1.iso / programg / c-tutor / answers / ch11_1c.cpp < prev   
Text File  |  1990-07-20  |  2KB  |  73 lines

  1.                             // Chapter 10 - Programming exercise 1
  2. #include "iostream.h"
  3. #include "person.hpp"
  4. #include "supervsr.hpp"
  5. #include "elemlist.hpp"
  6.  
  7. employee_list list;
  8.  
  9. main()
  10. {
  11. supervisor *suppt;
  12. programmer *progpt;
  13. secretary *secpt;
  14. consultant *conpt;
  15.  
  16.    cout << "XYZ Staff -- note salary is monthly.\n\n";
  17.  
  18.    suppt = new supervisor;
  19.    suppt->init_data("Big John", 5100, "President");
  20.    list.add_person(suppt);
  21.  
  22.    progpt = new programmer;
  23.    progpt->init_data("Joe Hacker", 3500, "debugger", "Pascal");
  24.    list.add_person(progpt);
  25.  
  26.    progpt = new programmer;
  27.    progpt->init_data("OOP Wizard", 7700, "senior analyst", "C++");
  28.    list.add_person(progpt);
  29.  
  30.    secpt = new secretary;
  31.    secpt->init_data("Tillie Typer", 2200, 1, 85);
  32.    list.add_person(secpt);
  33.  
  34.    conpt = new consultant;
  35.    conpt->init_data("Tom Consult", 5430, "Planner");
  36.    list.add_person(conpt);
  37.  
  38.    progpt = new programmer;
  39.    progpt->init_data("Dave Debugger", 5725, "code maintainer", 
  40.                                                 "assembly language");
  41.    list.add_person(progpt);
  42.  
  43.                   // Now display the entire list
  44.    list.display_list();
  45.  
  46.    cout << "End of employee list.\n";
  47. }
  48.  
  49.  
  50.  
  51.  
  52. // Result of execution
  53.  
  54. // XYZ Staff -- note salary is monthly.
  55. //
  56. // Supervisor --> Big John's salary is 5100 and is the President.
  57. //
  58. // Programmer --> Joe Hacker's salary is 3500 and is debugger.
  59. //                Joe Hacker's specialty is Pascal.
  60. //
  61. // Programmer --> OOP Wizard's salary is 7700 and is senior analyst.
  62. //                OOP Wizard's specialty is C++.
  63. //
  64. // Secretary ---> Tillie Typer's salary is 2200.
  65. //                Tillie typer types 85 per minute and can take shorthand.
  66. //
  67. // Consulting --> Tom Consult's salary is 5430 and is the Planner.
  68. //
  69. // Programmer --> Dave Debugger's salary is 5725 and is code maintainer.
  70. //                Dave Debugger's specialty is assembly language.
  71. //
  72. // End of employee list.
  73.